import java.util.Random;

/**
 * Created by asus on 2017/5/18.
 */
public class NewProject extends SetNum{
    public String Front(){
        String result;
        switch (getC()){

            case 0:
                result = getA()+Operator[getB()];

                break;
            case 1:
                result = getA()+Operator[getB()]+getA()+Operator[getB()];

                break;
            default:
                result = getA()+Operator[getB()]+getA()+Operator[getB()]+getA()+Operator[getB()];
        }
        return result;
    }
    public String Middle(){
        String result;
        switch (getC()){
            case 0:
                result = getA()+"";
                break;
            case 1:
                result ="("+getA()+Operator[getB()]+getA()+")";
                break;
                default:
                    result = "("+getA()+Operator[getB()]+"("+getA()+Operator[getB()]+getA()+")"+Operator[getB()]+getA()+")";
        }
        return result;
    }
    public String End(){
        String result;
        switch (getC()){
            case 0:
                result = Operator[getB()]+getA();
                break;
            case 1:
                result = Operator[getB()]+getA()+Operator[getB()]+getA();
                break;
                default:
                    result =  Operator[getB()]+getA()+Operator[getB()]+getA()+Operator[getB()]+getA();
        }
        return result;
    }
    public String Allpart(){
        String result;
        switch (getC()){
            case 0:
                result = Front()+Middle();
                break;
            case 1:
                result = Middle()+Front();
                default:
                    result = Front()+Middle()+End();
        }
        return result;
    }
    public String JudgeAllpart(){
        String result =Allpart();
        for(int i = 0;i<result.length();i++){
            if ((result.charAt(i)=='/')&&(result.charAt(i+1)=='0')){
                result = Allpart();
            }
        }
        return result;
    }

}
